﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Api.Application.Command.Detail.Cultivation;
using Traceability.App.ErrorCount;
using Traceability.App.Model.Cultivation;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CultivationsController : ControllerBase
    {
        IMediator mediator;

        public CultivationsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public Task<ApiResult<int>> AddCultivation(AddCultivationCommand request)
        {
            return mediator.Send(request);
        }
        [HttpGet]
        public Task<ApiResult<CultivationModel>> GetCultivation([FromQuery]GetCultivationCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> AddImmunity(AddImmunityCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public Task<ApiResult<ImmunityModel>> GetImmunity([FromQuery]GetImmunityCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPut]
        public Task<ApiResult<int>> UpdateImmunity(UpdateImmunityCommand request)
        {
            return mediator.Send(request);
        }
       
        [HttpPut]
        public Task<ApiResult<int>> DelImmunity(DelImmunityCommand request)
        {
            return  mediator.Send(request);
        }
        [HttpPost]
        public Task<ApiResult<int>> AddCultivationCommpany(AddCultivationCommpanyCommand request)
        {
            return mediator.Send(request);
        }
        [HttpGet]
        public Task<ApiResult<CultivationCommpanyModel>> GetCultivationCommpany([FromQuery]GetCultivationCommpanyCommand request)
        {
            return mediator.Send(request);
        }
    }
}
